package com.alipear.serverrequest;


import android.util.Log;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public class ServerRequest {

    private static AsyncHttpClient client = new AsyncHttpClient();
    
    public static void get(String url, RequestParams params,
            AsyncHttpResponseHandler responseHandler) {
    	Log.d("ServerRequest.get():", url);
        client.get(getAbsoluteUrl(url), params, responseHandler);
    }

    public static void get(String url, AsyncHttpResponseHandler responseHandler) {
    	Log.d("ServerRequest.get():", url);
        client.get(getAbsoluteUrl(url), null, responseHandler);
    }

    public static void post(String url, RequestParams params,
            AsyncHttpResponseHandler responseHandler) {
    	Log.d("ServerRequest.post():", url);
        client.post(getAbsoluteUrl(url), params, responseHandler);
    }

    public static void post(String url, AsyncHttpResponseHandler responseHandler) {
    	Log.d("ServerRequest.post():", url);
        client.post(getAbsoluteUrl(url), null, responseHandler);
    }

    private static String getAbsoluteUrl(String relativeUrl) {
        return relativeUrl;
    }
}
